using System;
using System.Collections.Generic;
using Dict.DataModel;

namespace Dict.Dao
{
    public class TableLevelLimitDao:DaoBase<TableLevelLimit>
    {
        public override void AddPrimaryIndex(TableLevelLimit model)
        {
            cachePrimary[model.playerLev.ToString()] = model;
        }

        public override string GetFileName()
        {
            return "TableLevelLimit.txt";
        }

        protected override TableLevelLimit ParseRowData(string[] rowData)
        {
            TableLevelLimit data = new TableLevelLimit();

            if (string.IsNullOrEmpty(rowData[0]))
            {
                data.playerLev = 0;
            }
            else
            {
                data.playerLev = int.Parse(rowData[0]);
            }

            if (string.IsNullOrEmpty(rowData[1]))
            {
                data.heroMaxLev = 0;
            }
            else
            {
                data.heroMaxLev = int.Parse(rowData[1]);
            }

            if (string.IsNullOrEmpty(rowData[2]))
            {
                data.equipMaxLev = 0;
            }
            else
            {
                data.equipMaxLev = int.Parse(rowData[2]);
            }

            if (string.IsNullOrEmpty(rowData[3]))
            {
                data.treaMaxLev = 0;
            }
            else
            {
                data.treaMaxLev = int.Parse(rowData[3]);
            }

            return data;
        }



    }

}
